package com.lagouedu.controller;

import com.lagouedu.pojo.Resume;
import com.lagouedu.repository.ResumeRepository;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class AbtestController {

    @Resource
    private ResumeRepository resumeRepository;

    @Value("${server.port}")
    private String port;

    @RequestMapping("/getPort")
    public String getPort(){
        System.out.println(port);
        return port;
    }

    @RequestMapping("/insert")
    public void testInsert(String name, Integer age, Double salary, Integer gender){
        Resume resume = new Resume();
        resume.setName(name);
        resume.setAge(age);
        resume.setSalary(salary);
        resume.setGender(gender);
        resumeRepository.save(resume);
    }

    @RequestMapping("/findAllResume")
    public List<Resume> getResumeList(){
        return resumeRepository.findAll();
    }

}
